#delimit ;
log using c:\expats\LINES\lines16\Tab4-6.log,replace;


* Amelia II used to impute missing data values, m=100, random number seed=902;
* See Supplemental Table 8 for question wordings;
* the key independent variables are loser2 (2=strong preference for unsuccessful candidate, 1=weak preference for an unsuccessful candidate, 0=did not prefer and unsuccessful candidate) and demidord2 (3=strong Democratic identifier, 2=weak Democratic ID, 1=lean Dem ID, 0=do not identify as a Democrat);
* original data are in _mi_m==0;

use c:\expats\lines\lines16\pii_worry-imp.dta;

mi import flong, m(imp) id(ID_W1_W2_W3) imp(worrydeport3 worryfin3
immrally3 rally1 partic1 partic3
trustwash1 trustwash3 nosay1 nosay3 publicoffnocare1 publicoffnocare3
trustamer1 trustamer3 return1 return3
religpool timeus agepool schoolpool famincpool spanhome 
marriedpool ownhome 
female weight civicstatus freshw2 freshw3 mex
hometownassoc difstatelaw_2017);


** code to produce results in Tables 4-6;

mi estimate: reg trustwash3 trustwash1 worrydeport3   i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];
mi estimate: reg nosay3 nosay1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];
mi estimate: reg publicoffnocare3 publicoffnocare1  worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];

mi estimate: reg trustamer3 trustamer1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];
mi estimate: ologit return3 return1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];

mi estimate: logit immrally3 rally1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];
mi estimate: ologit partic3 partic1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];


** impact of financial worries (measured in W3) on civic attitudes / participation;

mi estimate: reg trustwash3 trustwash1  worryfin3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];
mi estimate: reg nosay3 nosay1  worryfin3 i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];
mi estimate: reg publicoffnocare3 publicoffnocare1   worryfin3 i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];

mi estimate: reg trustamer3 trustamer1  worryfin3 i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];
mi estimate: ologit return3 return1 worryfin3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];

mi estimate: logit immrally3 rally1 worryfin3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];
mi estimate: ologit partic3 partic1 worryfin3 i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight];

*** commands for supplemental online Table S2;


reg trustwash3 trustwash1 worrydeport3   i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;
reg nosay3 nosay1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;
reg publicoffnocare3 publicoffnocare1  worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;

reg trustamer3 trustamer1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;
ologit return3 return1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;

logit immrally3 rally1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;
ologit partic3 partic1 worrydeport3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;


** impact of financial worries (measured in W3) on civic attitudes / participation;

reg trustwash3 trustwash1  worryfin3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;
reg nosay3 nosay1  worryfin3 i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;
reg publicoffnocare3 publicoffnocare1   worryfin3 i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;

reg trustamer3 trustamer1  worryfin3 i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;
ologit return3 return1 worryfin3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;

logit immrally3 rally1 worryfin3  i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;
ologit partic3 partic1 worryfin3 i.civicstatus time age span school faminc female ownhome relig mex difstatelaw_2017 [pweight=weight] if _mi_m==0;

stop
